home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Adobe Air 1.5 / AdobeAIRInstaller.exe / setup.swf / scripts / InstalledAppItemRenderer.as < prev    next >
Encoding:
Text File  |  2008-10-29  |  7.9 KB  |  253 lines

  1. package
  2. {
  3.    import flash.accessibility.*;
  4.    import flash.data.*;
  5.    import flash.debugger.*;
  6.    import flash.desktop.*;
  7.    import flash.display.*;
  8.    import flash.errors.*;
  9.    import flash.events.*;
  10.    import flash.external.*;
  11.    import flash.filesystem.*;
  12.    import flash.filters.*;
  13.    import flash.geom.*;
  14.    import flash.html.*;
  15.    import flash.html.script.*;
  16.    import flash.media.*;
  17.    import flash.net.*;
  18.    import flash.printing.*;
  19.    import flash.profiler.*;
  20.    import flash.system.*;
  21.    import flash.text.*;
  22.    import flash.ui.*;
  23.    import flash.utils.*;
  24.    import flash.xml.*;
  25.    import mx.binding.*;
  26.    import mx.containers.Canvas;
  27.    import mx.controls.Image;
  28.    import mx.controls.Label;
  29.    import mx.core.UIComponentDescriptor;
  30.    import mx.core.mx_internal;
  31.    import mx.events.PropertyChangeEvent;
  32.    import mx.skins.ProgrammaticSkin;
  33.    import mx.styles.*;
  34.    
  35.    use namespace mx_internal;
  36.    
  37.    public class InstalledAppItemRenderer extends Canvas implements IBindingClient
  38.    {
  39.       private static var _watcherSetupUtil:IWatcherSetupUtil;
  40.       
  41.       private var _437289382defaultIcon:Class;
  42.       
  43.       mx_internal var _bindingsByDestination:Object;
  44.       
  45.       mx_internal var _bindingsBeginWithWord:Object;
  46.       
  47.       private var _1149714771appLabel:Label;
  48.       
  49.       mx_internal var _watchers:Array;
  50.       
  51.       private var _1410965406iconImage:Image;
  52.       
  53.       mx_internal var _bindings:Array;
  54.       
  55.       private var _documentDescriptor_:UIComponentDescriptor;
  56.       
  57.       public function InstalledAppItemRenderer()
  58.       {
  59.          this._documentDescriptor_ = new UIComponentDescriptor({
  60.             "type":Canvas,
  61.             "propertiesFactory":function():Object
  62.             {
  63.                return {
  64.                   "height":20,
  65.                   "childDescriptors":[new UIComponentDescriptor({
  66.                      "type":Image,
  67.                      "id":"iconImage",
  68.                      "stylesFactory":function():void
  69.                      {
  70.                         this.verticalCenter = "0";
  71.                      },
  72.                      "propertiesFactory":function():Object
  73.                      {
  74.                         return {
  75.                            "height":16,
  76.                            "width":16
  77.                         };
  78.                      }
  79.                   }),new UIComponentDescriptor({
  80.                      "type":Label,
  81.                      "id":"appLabel",
  82.                      "stylesFactory":function():void
  83.                      {
  84.                         this.verticalCenter = "1";
  85.                      },
  86.                      "propertiesFactory":function():Object
  87.                      {
  88.                         return {
  89.                            "x":20,
  90.                            "percentWidth":100
  91.                         };
  92.                      }
  93.                   })]
  94.                };
  95.             }
  96.          });
  97.          this._437289382defaultIcon = InstalledAppItemRenderer_defaultIcon;
  98.          this.mx_internal::_bindings = [];
  99.          this.mx_internal::_watchers = [];
  100.          this.mx_internal::_bindingsByDestination = {};
  101.          this.mx_internal::_bindingsBeginWithWord = {};
  102.          super();
  103.          mx_internal::_document = this;
  104.          this.percentWidth = 100;
  105.          this.height = 20;
  106.       }
  107.       
  108.       public static function set watcherSetupUtil(param1:IWatcherSetupUtil) : void
  109.       {
  110.          InstalledAppItemRenderer._watcherSetupUtil = param1;
  111.       }
  112.       
  113.       public function set iconImage(param1:Image) : void
  114.       {
  115.          var _loc2_:Object = this._1410965406iconImage;
  116.          if(_loc2_ !== param1)
  117.          {
  118.             this._1410965406iconImage = param1;
  119.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"iconImage",_loc2_,param1));
  120.          }
  121.       }
  122.       
  123.       override public function initialize() : void
  124.       {
  125.          var bindings:Array;
  126.          var watchers:Array;
  127.          var i:uint;
  128.          var target:InstalledAppItemRenderer = null;
  129.          var watcherSetupUtilClass:Object = null;
  130.          mx_internal::setDocumentDescriptor(this._documentDescriptor_);
  131.          bindings = this._InstalledAppItemRenderer_bindingsSetup();
  132.          watchers = [];
  133.          target = this;
  134.          if(_watcherSetupUtil == null)
  135.          {
  136.             watcherSetupUtilClass = getDefinitionByName("_InstalledAppItemRendererWatcherSetupUtil");
  137.             watcherSetupUtilClass["init"](null);
  138.          }
  139.          _watcherSetupUtil.setup(this,function(param1:String):*
  140.          {
  141.             return target[param1];
  142.          },bindings,watchers);
  143.          i = 0;
  144.          while(i < bindings.length)
  145.          {
  146.             Binding(bindings[i]).execute();
  147.             i++;
  148.          }
  149.          mx_internal::_bindings = mx_internal::_bindings.concat(bindings);
  150.          mx_internal::_watchers = mx_internal::_watchers.concat(watchers);
  151.          super.initialize();
  152.       }
  153.       
  154.       [Bindable(event="propertyChange")]
  155.       public function get appLabel() : Label
  156.       {
  157.          return this._1149714771appLabel;
  158.       }
  159.       
  160.       override public function set data(param1:Object) : void
  161.       {
  162.          var _loc2_:String = null;
  163.          var _loc4_:String = null;
  164.          super.data = param1;
  165.          if(!param1)
  166.          {
  167.             return;
  168.          }
  169.          this.appLabel.text = param1.name;
  170.          var _loc3_:Array = [param1.icons["image16x16"],param1.icons["image32x32"],param1.icons["image48x48"],param1.icons["image128x128"]];
  171.          for each(_loc4_ in _loc3_)
  172.          {
  173.             if(_loc4_)
  174.             {
  175.                _loc2_ = _loc4_;
  176.                break;
  177.             }
  178.          }
  179.          if(!_loc2_)
  180.          {
  181.             this.iconImage.source = this.defaultIcon;
  182.          }
  183.          else
  184.          {
  185.             this.iconImage.source = "file://" + _loc2_;
  186.          }
  187.       }
  188.       
  189.       private function _InstalledAppItemRenderer_bindingExprs() : void
  190.       {
  191.          var _loc1_:* = undefined;
  192.          _loc1_ = this.defaultIcon;
  193.          _loc1_ = ProgrammaticSkin;
  194.       }
  195.       
  196.       [Bindable(event="propertyChange")]
  197.       private function get defaultIcon() : Class
  198.       {
  199.          return this._437289382defaultIcon;
  200.       }
  201.       
  202.       [Bindable(event="propertyChange")]
  203.       public function get iconImage() : Image
  204.       {
  205.          return this._1410965406iconImage;
  206.       }
  207.       
  208.       public function set appLabel(param1:Label) : void
  209.       {
  210.          var _loc2_:Object = this._1149714771appLabel;
  211.          if(_loc2_ !== param1)
  212.          {
  213.             this._1149714771appLabel = param1;
  214.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"appLabel",_loc2_,param1));
  215.          }
  216.       }
  217.       
  218.       private function _InstalledAppItemRenderer_bindingsSetup() : Array
  219.       {
  220.          var binding:Binding = null;
  221.          var result:Array = [];
  222.          binding = new Binding(this,function():Class
  223.          {
  224.             return defaultIcon;
  225.          },function(param1:Class):void
  226.          {
  227.             iconImage.setStyle("brokenImageSkin",param1);
  228.          },"iconImage.brokenImageSkin");
  229.          result[0] = binding;
  230.          binding = new Binding(this,function():Class
  231.          {
  232.             return ProgrammaticSkin;
  233.          },function(param1:Class):void
  234.          {
  235.             iconImage.setStyle("brokenImageBorderSkin",param1);
  236.          },"iconImage.brokenImageBorderSkin");
  237.          result[1] = binding;
  238.          return result;
  239.       }
  240.       
  241.       private function set defaultIcon(param1:Class) : void
  242.       {
  243.          var _loc2_:Object = this._437289382defaultIcon;
  244.          if(_loc2_ !== param1)
  245.          {
  246.             this._437289382defaultIcon = param1;
  247.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"defaultIcon",_loc2_,param1));
  248.          }
  249.       }
  250.    }
  251. }
  252.  
  253.